<style>
.setimg{
	margin:-2px 5px 0 0 
}
a:hover{
	cursor:pointer;
}
.color_red{
	color: red;
}
.color_purple{
	color: purple;
}
.color_orange{
	color: orange;
}
</style>
<link rel="stylesheet" href="/statics/css/emoji.css">
<div class="row-fluid">
	<a style="border:1px solid #ccc" class="block-heading" data-toggle="collapse">列表数据</a>
    <div class="well">
	<button class="btn btn-primary ifrm" data-url="/index/addCust" data-width="720" data-height="420" data-title="添加用户" data-params="" style="float:right;padding:3px 6px">添加用户</button>
	    <div class="btn-toolbar">
		    <form>
		    	<label style="display: inline;margin-left:10px">手机号码：</label>
		    	<input class="input input-medium" type="text" name="cust_mobile" value="<?=I('get.cust_mobile')?>" />


		    	<!--<label style="display: inline;margin-left:10px">直播类型：</label>-->
		    	<!--<select name="live_cate" style="width:100px;">-->
		    		<!--<foreach name="live_type" item="vo" key="ke">-->
					    <!--<option value="<?=$ke?>" <?=$ke == I('get.live_cate')? 'selected': ''?>><?=$vo?></option>-->
					<!--</foreach>-->
		    	<!--</select>-->

				<label style="display: inline;margin-left:10px">用户类别：</label>
				<select name="user_type" class="user_type" style="width:100px;">
					<foreach name="user_type" item="vo" key="ke">
						<option value="<?=$ke?>" <?=$ke == I('get.user_type')? 'selected': ''?>><?=$vo?></option>
					</foreach>
				</select>
                <!--员工的级别选择-->
                <span class="level1" style="display: none"><label style="display: inline;margin-left:10px">用户级别：</label>
                    <select name="user_level" style="width:100px;">
						<option value="">请选择</option>
                        <option value="1" <?=$getData['user_level']==1?'selected':''?>>一级</option>
                        <option value="2" <?=$getData['user_level']==2?'selected':''?>>二级</option>
                        <option value="3" <?=$getData['user_level']==3?'selected':''?>>三级</option>
                    </select>
                </span>
                <span class="level2" style="display: none;"><label style="display: inline;margin-left:10px">用户级别：</label>
                    <select name="user_level2" class="user_level" style="width:100px;">
						<option value="">请选择</option>
                        <option value="1" <?=$getData['user_level']==1?'selected':''?>>普通员工</option>
                        <option value="2" <?=$getData['user_level']==2?'selected':''?>>部门领导</option>
                        <option value="3" <?=$getData['user_level']==3?'selected':''?>>级别领导</option>
                    </select>
                </span>
                <p class="depart" style="display: none;"><label style="display: inline;margin-left:10px">所属部门：</label>
                    <select name="depart_id" style="width:100px;">
						<option value="">请选择</option>
                        <?php foreach($depart as $val){?>
                        <option value="<?=$val['id']?>" <?=$val['id']==$getData['depart_id']?'selected':''?>><?=$val['name']?></option>
                        <?php }?>
                    </select>
                </p>
		    	<input type="hidden" value="<?=I('get.res')?>" name="res" />
		    	<button class="btn btn-info" style="margin:-9px 0 0 15px"><i class="icon-search"></i> 搜索</button>
				<span class="btn btn-info linetaff" style="margin:-61px 30px;float: right;padding: 2px 7px;">员工等级</span>
				<span class="btn btn-info lineCount" style="margin:-61px -70px 0 15px;float: right;padding: 2px 7px;">服务商等级</span>
		    </form>
		</div>
		<hr>
		<?php include('./statics/css/emoji.php');?>
		<table class="table">
		      <thead>
		        <tr>
		          <th style="text-align:center;width:100px">序号id</th>
		          <th style="text-align:center;width:170px">用户姓名</th>
		          <th style="text-align:center;width:170px">手机号码</th>
		          <th style="text-align:center;width:170px">用户类别</th>
		          <th style="text-align:center;width:170px">用户级别</th>
		          <th style="text-align:center;width:170px">直播权限</th>
		          <th style="text-align:center;width:140px">注册时间</th>
		      	  <th style="text-align:center;width:130px">操作</th>
		        </tr>
		      </thead>
		      <tbody>
		      	<?php if($getData){foreach($getData AS $key=>$val){ ?>
		        <tr> 
		          <td style="text-align:center;vertical-align:middle;"><?=$val['cust_id']?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['cust_realname'] ?></td>
		          <td style="text-align:center;vertical-align:middle;"><?=$val['cust_mobile'] ?></td>
		          <td style="text-align:center;vertical-align:middle;">
			          <?php
						if($val['user_type'] == 1){
							echo '服务商';
						}elseif($val['user_type'] == 2){
							echo '店家';
						}elseif($val['user_type'] == 3){
							echo '员工';
						}else{
							echo '普通用户';
						}
			          ?>
		          </td>
		          <td style="text-align:center;vertical-align:middle;">
			          <?php
						if($val['user_type'] == 1){
							if($val['user_level'] == 1){
								echo '一级';
							}elseif($val['user_level'] == 2){
								echo '二级';
							}elseif($val['user_level'] == 3){
								echo '三级';
							}
						}else{
							if($val['user_level'] == 1){
								echo '普通员工';
							}elseif($val['user_level'] == 2){
								echo '部门领导';
							}elseif($val['user_level'] == 3){
								echo '级别领导';
							}
						}
			          ?>
		          </td>
		          <td style="text-align:center;vertical-align:middle;">
		          	<!-- <input type="hidden" value="<?=$val['cust_id']?>"> -->
		          	<!-- <a class="anchor <?=$val['is_anchor']==1?'color_red':''?>"><?=$val['is_anchor']==1?'是':'否'?></a> -->
		          	<?php if($val['is_anchor']==1){ ?>
		          	<a class="ifrm btn <?=$val['live_cate']==1?'color_orange':($val['live_cate']==2?'color_pruple':'color_red')?>" href="javascript:void(0)" data-url="/index/setAnchor" data-width="770" data-height="310" style="padding: 0px 4px;" data-params="id/<?=$val['cust_id']?>/is/1"><?=$live_type[$val['live_cate']]?></a>
		          	<?php }else{?>
		          	<a class="ifrm btn" href="javascript:void(0)" data-url="/index/setAnchor" data-width="770" data-height="310" style="padding: 0px 4px;" data-params="id/<?=$val['cust_id']?>/is/0">无</a>
		          	<?php }?>
		          </td>
		          <td style="text-align:center;vertical-align:middle;"><?=date('Y-m-d H:i',$val['add_at'])?></td>
		          <td style="text-align:center;vertical-align:middle;">
		              <a class="ifrm btn btn-info" href="javascript:void(0)" data-url="/index/addCust" style="padding: 0px 4px;" data-width="680" data-height="430" data-title="修改信息" data-params="cust_id/<?=$val['cust_id']?>"><i class="icon-pencil"></i></a>&nbsp;&nbsp;
		              <?php if($val['check']){?>
					  	  <a href="/index/decate?custid=<?=$val['cust_id']?>&m=CustEntity" class="decate btn btn-danger" style="padding: 0px 4px;" role="button" title="冻结用户" data-toggle="modal"><i class="icon-eye-close"></i></a>&nbsp;&nbsp;
					  <?php }else{ ?>
					      <a href="/index/decate?custid=<?=$val['cust_id']?>&types=1&m=CustEntity" class="decate btn btn-warning" style="padding: 0px 4px;" role="button" title="解封用户" data-toggle="modal"><i class="icon-eye-open"></i></a>&nbsp;&nbsp;
					  <?php }?>

					  <?php if($val['user_type'] == 2 && $val['ispass'] != 1){?>
					  <a href="javascript:void(0)" data-url="/index/isPass" class="ifrm btn" style="padding: 0px 4px;" data-width="680" data-height="430" data-title="店家审核" data-params="cust_id/<?=$val['cust_id']?>">店家审核</a>&nbsp;&nbsp;
					  <?php } ?>
				 </td>
		        </tr>
		        <?php }}else{?>
		        	<tr><td style="text-align:center" colspan=7>暂无数据</td></tr>
		        <?php }?>
		      </tbody>
		   </table>
		   <span style="float:right;margin-top:-44px"><?=$page?></span>
	</div>
</div>
<script>
$(function(){
	$('.decate').live('click',function(){
		if(!window.confirm('确认'+$(this).attr('title')+'吗 ?')){
			return false;
		}
		window.location = $(this).attr('href');
	});
    $(".user_type").change(function(){
        var status = $('.user_type option:selected') .val();
        if(status ==3){
            $('.level2').show();
            $('.level1').hide();
        }else if(status ==1){
            $('.level1').show();
            $('.level2').hide();
        }else{
            $('.level1').hide();
            $('.level2').hide();
        }

    });
    $(".user_level").change(function(){
        var status = $('.user_level option:selected') .val();
        if(status ==2){
            $('.depart').show();
        }else{
            $('.depart').hide();
        }
    });

    $('.lineCount').click(function(){
        art.dialog.open('/index/showLevel/ifm/1/type/1',
            {
                id: 'SETCHOSEID',
                width: '100%',
                height: '100%',
                left: '0%',
                top: '0%',
                fixed: true,
                resize: false,
                drag: false,
                title: '服务商等级'
            });
    });

    $('.linetaff').click(function(){
        art.dialog.open('/index/showLevel/ifm/1/type/2',
            {
                id: 'SETCHOSEID',
                width: '100%',
                height: '100%',
                left: '0%',
                top: '0%',
                fixed: true,
                resize: false,
                drag: false,
                title: '店家等级'
            });
    });
})
</script>